package com.ln.store.dao.Impl;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.ln.store.dao.CategoryDao;
import com.ln.store.domain.Category;
import com.ln.store.domain.User;
import com.ln.store.utils.JDBCUtils;

public class CategoryImpl implements CategoryDao {

	public List<Category> getAllCats() throws SQLException {
		
		QueryRunner queryRunner = new QueryRunner(JDBCUtils.getDataSource());
		
		String sql = "select * from category";
		
		return queryRunner.query(sql, new BeanListHandler<Category>(Category.class));
	}

}
